package com.jams.goodox.net.services;

import com.jams.goodox.constant.UrlConstants;
import com.jams.goodox.entity.AfterSaleLists;
import com.jams.goodox.entity.ApplyFormBean;
import com.jams.goodox.entity.ApplyScheduleBean;
import com.jams.goodox.entity.LogisticsInfo;
import com.jams.goodox.entity.OrderDealDetailInfo;
import com.jams.goodox.entity.resp.LogisticsListResp;
import com.jams.goodox.entity.resp.OrderCountResp;
import com.jams.goodox.entity.resp.OrderListResp;
import com.jams.goodox.entity.resp.OrderSearchResultResp;
import com.jams.goodox.entity.resp.ScanPayInfoResp;
import com.jams.goodox.entity.resp.ScanShopInfoResp;
import com.jams.goodox.entity.resp.ServerOrderInfoResp;
import com.jams.goodox.entity.resp.SimpleResp;

import java.util.Map;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * Created by jams on 2016/9/26.
 * ***
 * Tel: ***
 */

public interface OrderService {

    //获取未读、未付款数量
    @GET(UrlConstants.getOrderCount)
    Call<OrderCountResp> getOrderCount(@Query("userId") String userId);

    //获取订单列表
    @GET(UrlConstants.MY_ORDER)
    Call<OrderListResp> getMyOrderList(@Query("userId") String userId,@Query("orderStatus") String orderStatus, @Query("curPage") int curPage, @Query("pageSize") int pageSize);

    //获取物流列表
    @GET(UrlConstants.LogisticsList)
    Call<LogisticsListResp> getLogistics(@Query("orderId") String orderId);

    //获取物流详情
    @GET(UrlConstants.queryLogisticsDetail)
    Call<LogisticsInfo> queryEmsDetail(@Query("code") String code, @Query("id") String id, @Query("orderId") String orderId);

    //提交售后申请
    @Multipart
    @POST(UrlConstants.cancelApplyFrom)
    Call<SimpleResp> returnGoods(@Part("detailId") RequestBody detailId, @Part("explain") RequestBody explain,
                                 @Part("orderId") RequestBody orderId, @Part("reason") RequestBody reason,
                                 @Part("type") RequestBody type, @PartMap Map<String, RequestBody> imageList);

    //申请取消订单
    @FormUrlEncoded
    @POST(UrlConstants.cancelApplyFrom)
    Call<SimpleResp> cancelApplyFrom(@Field("explain") String explain,
                                     @Field("orderId") String orderId, @Field("reason") String reason,
                                     @Field("type") String type);


    //获取订单详情
    @GET(UrlConstants.ORDER_DETAIL)
    Call<ServerOrderInfoResp> getOrderDetail(@Query("orderId") String orderId);

    //取消订单
    @FormUrlEncoded
    @PUT(UrlConstants.CANCEL_ORDER)
    Call<SimpleResp> cancelOrder(@Field("orderId") String oid);

    //提交评价
    @FormUrlEncoded
    @POST(UrlConstants.ORDER_ASSESS)
    Call<SimpleResp> orderAssess(@Field("appraiseInfo") String appraiseInfo);

    //处理详情列表
    @GET(UrlConstants.queryOperateList)
    Call<OrderDealDetailInfo> getOperateList(@Path("orderId") String orderId);

    //售后记录列表
    @GET(UrlConstants.afterSalesList)
    Call<AfterSaleLists> getAfterSaleList(@Query("userId") String userId,@Query("curPage") int curPage, @Query("pageSize") int pageSize, @Query("orderId") String orderId);

    //售后进度详情
    @GET(UrlConstants.customerSchedule)
    Call<ApplyScheduleBean> getScheduleDetail(@Path("id") String id);

    //申请单详情
    @GET(UrlConstants.applyFormDetail)
    Call<ApplyFormBean> getApplyFormDetail(@Path("id") String id);

    //填写物流
    @FormUrlEncoded
    @POST(UrlConstants.addEmsMessage)
    Call<SimpleResp> addEmsInfo(@Field("id") String id, @Field("expressCompany") String expressCompany, @Field("expressNo") String expressNo, @Field("expressCode") String expressCode);

    //验证物流号和物流公司是否匹配
    @GET(UrlConstants.checkEmsNub)
    Call<SimpleResp> checkEmsNub(@Query("comCode") String comCode, @Query("number") String number);

    //取消售后申请
    @POST(UrlConstants.cancelApply)
    Call<SimpleResp> cancelSaleOrder(@Path("id") String id);

    //订单搜索
    @GET(UrlConstants.queryOrderBySer)
    Call<OrderSearchResultResp> orderSearch(@Query("userId") String userId,@Query("searchValue") String searchValue);

    //获取商家信息
    @GET(UrlConstants.scanGetShopInfo)
    Call<ScanShopInfoResp> getShopInfo(@Query("shopId") String shopId);

    //获取扫一扫转账信息
    @GET(UrlConstants.scanGetPayInfo)
    Call<ScanPayInfoResp> getPayInfo(@Query("moneyChange") String moneyChange,@Query("shopId") String shopId);
}